//
//  UIViewController+Share.m
//  guess
//
//  Created by apple on 15/11/6.
//  Copyright © 2015年 fank. All rights reserved.
//

#import "UIViewController+Share.h"
#import "WXApi.h"
#import "YXApi.h"
#import <TencentOpenAPI/QQApiInterface.h>

@implementation UIViewController (Share)
//-(void)shareFunWithShareInfo:(NSDictionary *)dictionary
//{
//    BOOL isInstallWeChat = [WXApi isWXAppInstalled];
//    BOOL isInstallYixin = [YXApi isYXAppInstalled];
//    BOOL isInstallQQ    = [QQApiInterface isQQInstalled];
//    
//    NSMutableArray *array = [NSMutableArray array];
//    if (isInstallYixin == YES) {
//        [array addObject:UMShareToYXSession];
//        [array addObject:UMShareToYXTimeline];
//    }
//    if (isInstallWeChat == YES) {
//        [array addObject:UMShareToWechatFavorite];
//        [array addObject:UMShareToWechatSession];
//        [array addObject:UMShareToWechatTimeline];
//    }
//    [array addObject:UMShareToSina];
//    if (isInstallQQ == YES) {
//        [array addObject:UMShareToQQ];
//    }
//    if (([[dictionary objectForKey:@"shareType"] isEqualToString:@"news"] || [[dictionary objectForKey:@"shareType"] isEqualToString:@"setting"]) && isInstallQQ == YES) {
//        [array addObject:UMShareToQzone];
//    }
//    [array addObject:UMShareToEmail];
//    [array addObject:UMShareToSms];
//    if (dictionary) {
//        if ([[dictionary objectForKey:@"shareType"] isEqualToString:@"news"] || [[dictionary objectForKey:@"shareType"] isEqualToString:@"setting"]) {
//            //易信好友
//            [UMSocialData defaultData].extConfig.yxsessionData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.yxsessionData.yxMessageType = UMSocialYXMessageTypeWeb;
//            [UMSocialData defaultData].extConfig.yxsessionData.url = [dictionary objectForKey:@"url"];
//            //易信朋友圈
//            [UMSocialData defaultData].extConfig.yxtimelineData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.yxtimelineData.yxMessageType = UMSocialYXMessageTypeWeb;
//            [UMSocialData defaultData].extConfig.yxtimelineData.url = [dictionary objectForKey:@"url"];
//            //微信收藏
//            [UMSocialData defaultData].extConfig.wechatFavoriteData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.wechatFavoriteData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.wechatFavoriteData.url = [dictionary objectForKey:@"url"];
//            [UMSocialData defaultData].extConfig.wechatFavoriteData.wxMessageType = UMSocialWXMessageTypeWeb;
//            //微信好友
//            [UMSocialData defaultData].extConfig.wechatSessionData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.wechatSessionData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.wechatSessionData.url = [dictionary objectForKey:@"url"];
//            [UMSocialData defaultData].extConfig.wechatSessionData.wxMessageType = UMSocialWXMessageTypeWeb;
//            //微信朋友圈
//            [UMSocialData defaultData].extConfig.wechatTimelineData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.wechatTimelineData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.wechatTimelineData.url = [dictionary objectForKey:@"url"];
//            [UMSocialData defaultData].extConfig.wechatTimelineData.wxMessageType = UMSocialWXMessageTypeWeb;
//            //新浪微博
//            [UMSocialData defaultData].extConfig.sinaData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            UMSocialUrlResource *urlResource = [[UMSocialUrlResource alloc]init];
//            urlResource.url = [dictionary objectForKey:@"url"];
//            [UMSocialData defaultData].extConfig.sinaData.urlResource = urlResource;
//            //腾讯微博
//            [UMSocialData defaultData].extConfig.tencentData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.tencentData.urlResource = urlResource;
//            //QQ
//            [UMSocialData defaultData].extConfig.qqData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.qqData.url = [dictionary objectForKey:@"url"];
//            [UMSocialData defaultData].extConfig.qqData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.qqData.qqMessageType = UMSocialQQMessageTypeDefault;
//            //QQ空间
//            [UMSocialData defaultData].extConfig.qzoneData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.qzoneData.url = [dictionary objectForKey:@"url"];
//            [UMSocialData defaultData].extConfig.qzoneData.title = [dictionary objectForKey:@"title"];
//            //邮箱
//            [UMSocialData defaultData].extConfig.emailData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//            [UMSocialData defaultData].extConfig.emailData.title = [dictionary objectForKey:@"title"];
//            //短信
//            [UMSocialData defaultData].extConfig.smsData.shareImage = [UIImage imageNamed:@"zhangda.png"];
//        }else if ([[dictionary objectForKey:@"shareType"] isEqualToString:@"secondHend"] || [[dictionary objectForKey:@"shareType"] isEqualToString:@"pinba"] || [[dictionary objectForKey:@"shareType"] isEqualToString:@"study"]){
//            //易信好友
//            [UMSocialData defaultData].extConfig.yxsessionData.yxMessageType = UMSocialYXMessageTypeText;
//            //易信朋友圈
//            [UMSocialData defaultData].extConfig.yxtimelineData.yxMessageType = UMSocialYXMessageTypeText;
//            //微信收藏
//            [UMSocialData defaultData].extConfig.wechatFavoriteData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.wechatFavoriteData.wxMessageType = UMSocialYXMessageTypeText;
//            //微信好友
//            [UMSocialData defaultData].extConfig.wechatSessionData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.wechatSessionData.wxMessageType = UMSocialYXMessageTypeText;
//            //微信朋友圈
//            [UMSocialData defaultData].extConfig.wechatTimelineData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.wechatTimelineData.wxMessageType = UMSocialYXMessageTypeText;
//            //新浪微博
//            [UMSocialData defaultData].extConfig.sinaData.shareImage = nil;
//            [UMSocialData defaultData].extConfig.sinaData.urlResource = nil;
//            //腾讯微博
//            [UMSocialData defaultData].extConfig.tencentData.urlResource = nil;
//            //QQ
//            [UMSocialData defaultData].extConfig.qqData.url = nil;
//            [UMSocialData defaultData].extConfig.qqData.title = [dictionary objectForKey:@"title"];
//            [UMSocialData defaultData].extConfig.qqData.qqMessageType = UMSocialQQMessageTypeDefault;
//            //邮箱
//            [UMSocialData defaultData].extConfig.emailData.title = [dictionary objectForKey:@"title"];
//        }
//    }
////    [UMSocialSnsService presentSnsIconSheetView:self appKey:UmengAppkey shareText:self.shareText shareImage:nil shareToSnsNames:array delegate:self];
//}
//
////实现回调方法（可选）：
//-(void)didFinishGetUMSocialDataInViewController:(UMSocialResponseEntity *)response
//{
//    //根据`responseCode`得到发送结果,如果分享成功
//    if(response.responseCode == UMSResponseCodeSuccess)
//    {
//        //得到分享到的微博平台名
//        NSLog(@"share to sns name is %@",[[response.data allKeys] objectAtIndex:0]);
//    }
//}

@end
